package com.example.springaop.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/user")
public class UserController {

    @RequestMapping(value = "/sayhi")
    public String sayHi(){
        System.out.println("sayHi 方法：被执行了。");
        return "你好，世界。";
    }

    @RequestMapping(value = "/sayhello")
    public String sayHello(){
        System.out.println("sayHello 方法：被执行了。");
        int num = 10/0;// 算术异常，除数不能为 0
        return "hello world!";
    }
}
